<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>下单界面</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary-color: #4a6cf7;
            --secondary-color: #6a11cb;
            --accent-color: #ff6b6b;
            --text-dark: #2c3e50;
            --text-light: #718096;
            --bg-light: #f8f9fa;
            --card-shadow: 0 10px 40px rgba(0,0,0,0.1);
            --button-shadow: 0 6px 15px rgba(74, 108, 247, 0.3);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background-color: var(--bg-light);
            color: var(--text-dark);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            background-image: linear-gradient(135deg, #f5f7fa 0%, #e4ecfb 100%);
        }

        /* 上层样式 - 顶部导航栏 */
        .top-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 15px 30px;
            background-color: white;
            box-shadow: 0 4px 15px rgba(0,0,0,0.08);
            position: sticky;
            top: 0;
            z-index: 100;
        }

        .back-btn {
            background-color: var(--primary-color);
            color: white;
            border: none;
            padding: 12px 24px;
            border-radius: 8px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 10px;
            box-shadow: var(--button-shadow);
        }

        .back-btn:hover {
            background-color: #3a5ce0;
            transform: translateY(-3px);
            box-shadow: 0 8px 20px rgba(74, 108, 247, 0.4);
        }

        .page-title {
            font-size: 24px;
            font-weight: 700;
            color: var(--text-dark);
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .user-display {
            display: flex;
            align-items: center;
            gap: 15px;
            background: rgba(74, 108, 247, 0.1);
            padding: 8px 20px;
            border-radius: 50px;
            border: 1px solid rgba(74, 108, 247, 0.2);
        }

        .user-icon {
            color: var(--primary-color);
            font-size: 18px;
        }

        .username {
            font-weight: 600;
            color: var(--primary-color);
        }

        /* 下单表单区域 */
        .order-container {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 30px;
        }

        .order-card {
            width: 100%;
            max-width: 600px;
            background-color: white;
            border-radius: 20px;
            box-shadow: var(--card-shadow);
            overflow: hidden;
        }

        .card-header {
            background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
            color: white;
            padding: 30px;
            text-align: center;
            font-size: 24px;
            font-weight: 700;
            position: relative;
            overflow: hidden;
        }

        .card-body {
            padding: 40px;
        }

        .form-group {
            margin-bottom: 30px;
            position: relative;
        }

        .form-label {
            display: block;
            margin-bottom: 12px;
            font-weight: 600;
            color: var(--text-dark);
            font-size: 16px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .form-icon {
            color: var(--primary-color);
            font-size: 18px;
        }

        .form-input {
            width: 100%;
            padding: 16px 20px;
            border: 2px solid #e2e8f0;
            border-radius: 12px;
            font-size: 16px;
            transition: all 0.3s;
            box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
        }

        .form-input:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 4px rgba(74, 108, 247, 0.2);
            outline: none;
        }

        .form-input::placeholder {
            color: #a0aec0;
        }

        .form-hint {
            display: block;
            margin-top: 8px;
            color: var(--text-light);
            font-size: 14px;
            padding-left: 28px;
        }

        .submit-btn {
            width: 100%;
            padding: 18px;
            background: linear-gradient(135deg, var(--accent-color) 0%, #ff9a9e 100%);
            color: white;
            font-size: 18px;
            font-weight: 700;
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 6px 15px rgba(255, 107, 107, 0.3);
            margin-top: 20px;
            position: relative;
            overflow: hidden;
            z-index: 1;
        }

        .submit-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 10px 25px rgba(255, 107, 107, 0.4);
        }

        .submit-btn:active {
            transform: translateY(1px);
        }

        .submit-btn i {
            margin-right: 10px;
        }

        /* 验证提示 */
        .error-message {
            color: #e53e3e;
            font-size: 14px;
            margin-top: 8px;
            padding-left: 28px;
            display: none;
        }

        .form-input:invalid:not(:placeholder-shown) {
            border-color: #e53e3e;
        }

        .form-input:invalid:not(:placeholder-shown) + .error-message {
            display: block;
        }

        /* 响应式调整 */
        @media (max-width: 768px) {
            .top-bar {
                padding: 12px 20px;
            }

            .back-btn {
                padding: 10px 18px;
                font-size: 14px;
            }

            .page-title {
                font-size: 20px;
            }

            .user-display {
                padding: 6px 15px;
            }

            .card-body {
                padding: 30px 20px;
            }

            .card-header {
                padding: 20px;
                font-size: 20px;
            }
        }

        @media (max-width: 480px) {
            .top-bar {
                flex-wrap: wrap;
                gap: 10px;
                justify-content: center;
            }

            .back-btn {
                order: 1;
            }

            .page-title {
                position: static;
                transform: none;
                order: 3;
                width: 100%;
                text-align: center;
                margin-top: 10px;
            }

            .user-display {
                order: 2;
            }
        }
    </style>
</head>
<body>
<!-- 上层：顶部导航栏 -->
<div class="top-bar">
    <!-- 返回按钮 -->
    <button class="back-btn" onclick="location.href='/clients/clientmain'">
        <i class="fas fa-arrow-left"></i> 返回主页
    </button>

    <!-- 页面标题 -->
    <div class="page-title">下单</div>

    <!-- 用户信息显示区域 -->
    <div class="user-display">
        <i class="fas fa-user-circle user-icon"></i>
        <span class="username" th:text="${user != null} ? ${user.username} : '游客'">用户名</span>
    </div>
</div>

<!-- 下层：下单表单 -->
<div class="order-container">
    <div class="order-card">
        <div class="card-header">
            <i class="fas fa-shopping-cart"></i> 填写订单信息
        </div>

        <div class="card-body">
            <form id="orderForm" th:action="@{/clients/clientorder}" method="post" novalidate>
                <!-- 配送地址 -->
                <div class="form-group">
                    <label for="address" class="form-label">
                        <i class="fas fa-map-marker-alt form-icon"></i> 配送地址
                    </label>
                    <input type="text" id="address" name="address"
                           class="form-input" placeholder="请输入详细配送地址"
                           required >
                    <span class="form-hint">请填写完整的配送地址，包括街道、门牌号等信息</span>
                    <span class="form-hint">配送费为2元，请保证账户余额大于两元</span>
                    <span class="form-hint">下单成功后自动返回主页面</span>
                </div>
                <!-- 提交按钮 -->
                <button type="submit" class="submit-btn">
                    <i class="fas fa-check-circle"></i> 确认下单
                </button>
            </form>
        </div>
    </div>
</div>
</body>
</html>